package com.ruoyi.recipe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.recipe.mapper.RecipeSlidePicMapper;
import com.ruoyi.recipe.domain.RecipeSlidePic;
import com.ruoyi.recipe.service.IRecipeSlidePicService;
import com.ruoyi.common.core.text.Convert;

/**
 * 轮播图Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-23
 */
@Service
public class RecipeSlidePicServiceImpl implements IRecipeSlidePicService 
{
    @Autowired
    private RecipeSlidePicMapper recipeSlidePicMapper;

    /**
     * 查询轮播图
     * 
     * @param picId 轮播图主键
     * @return 轮播图
     */
    @Override
    public RecipeSlidePic selectRecipeSlidePicByPicId(Long picId)
    {
        return recipeSlidePicMapper.selectRecipeSlidePicByPicId(picId);
    }

    /**
     * 查询轮播图列表
     * 
     * @param recipeSlidePic 轮播图
     * @return 轮播图
     */
    @Override
    public List<RecipeSlidePic> selectRecipeSlidePicList(RecipeSlidePic recipeSlidePic)
    {
        return recipeSlidePicMapper.selectRecipeSlidePicList(recipeSlidePic);
    }

    /**
     * 新增轮播图
     * 
     * @param recipeSlidePic 轮播图
     * @return 结果
     */
    @Override
    public int insertRecipeSlidePic(RecipeSlidePic recipeSlidePic)
    {
        recipeSlidePic.setCreateTime(DateUtils.getNowDate());
        return recipeSlidePicMapper.insertRecipeSlidePic(recipeSlidePic);
    }

    /**
     * 修改轮播图
     * 
     * @param recipeSlidePic 轮播图
     * @return 结果
     */
    @Override
    public int updateRecipeSlidePic(RecipeSlidePic recipeSlidePic)
    {
        recipeSlidePic.setUpdateTime(DateUtils.getNowDate());
        return recipeSlidePicMapper.updateRecipeSlidePic(recipeSlidePic);
    }

    /**
     * 批量删除轮播图
     * 
     * @param picIds 需要删除的轮播图主键
     * @return 结果
     */
    @Override
    public int deleteRecipeSlidePicByPicIds(String picIds)
    {
        return recipeSlidePicMapper.deleteRecipeSlidePicByPicIds(Convert.toStrArray(picIds));
    }

    /**
     * 删除轮播图信息
     * 
     * @param picId 轮播图主键
     * @return 结果
     */
    @Override
    public int deleteRecipeSlidePicByPicId(Long picId)
    {
        return recipeSlidePicMapper.deleteRecipeSlidePicByPicId(picId);
    }
}
